import { networkTypePageSelect } from '@/api/network'
import { ref } from 'vue'
import { NetworkType } from './types'

// 加载
const loading = ref(false)

// 下拉选项
const options = ref<Array<NetworkType>>([])

/**
 * 获取网点分类下拉选项
 * @param {(string|undefined)} keywork - 关键字
 */
async function getOptions(keywork: string) {
  loading.value = true
  const questionParam = {
    limit: 0,
    name: keywork,
    page: 0,
  }
  const res = await networkTypePageSelect(questionParam)
  options.value = res.data.data.rows
  loading.value = false
}
export default {
  loading,
  options,
  getOptions,
}
